﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebMVC.Areas.AdminPanel.Models;
using System.IO;

namespace WebMVC.Areas.AdminPanel.Controllers
{
    public class DashboardController : AdminControllerBase
    {
        //
        // GET: /AdminPanel/Dashboard/

        public ActionResult Index()
        {
            return View();
        }


        [ChildActionOnly]
        public ActionResult UserStatistic()
        {
            var model = new UserStatisticViewModel()
            {
                RegisteredInPast24 = 0,
                RegisteredToday = 0,
                TotalApprovedUsers = 0,
                TotalUsers = 0,
                UsersOnline = 0
            };
            return PartialView(model);
        }

        [ChildActionOnly]
        public ActionResult SystemState()
        {
            DriveInfo[] drives = DriveInfo.GetDrives();
            DriveInfo mainDrive = null;
            foreach (DriveInfo drive in drives)
            {
                if (drive.IsReady && drive.Name.ToLower().Equals("c:\\"))
                {
                    mainDrive = drive;
                    break;
                }
            }

            var model = new SystemStateViewModel()
            {
                FreeDiskSpaceMB = mainDrive.TotalFreeSpace / (1024 * 1024),
                TotalDiskSpaceMB = mainDrive.TotalSize / (1024 * 1024)
            };
            return PartialView(model);
        }

        [ChildActionOnly]
        public ActionResult MonitoringStatus()
        {
            var model = new MonitoringViewModel()
            {
                SMTPServerStatus = ModuleStatus.OK,
                DataBaseStatus = ModuleStatus.OK,
            };
            return PartialView(model);
        }


       
    }
}
